//===------------ include/Reader/bytecodetowvmcode.def ----------*- C++ -*-===//
//
// LLILC
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license.
// See LICENSE file in the project root for full license information.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief Declares array for reader.cpp
///
//===----------------------------------------------------------------------===//

// Array which maps bytecode to WVM opcode
static const ReaderBaseNS::OPCODE ByteCodes[256] = {
  ReaderBaseNS::CEE_NOP,            ReaderBaseNS::CEE_BREAK,
  ReaderBaseNS::CEE_LDARG_0,        ReaderBaseNS::CEE_LDARG_1,
  ReaderBaseNS::CEE_LDARG_2,        ReaderBaseNS::CEE_LDARG_3,
  ReaderBaseNS::CEE_LDLOC_0,        ReaderBaseNS::CEE_LDLOC_1,
  ReaderBaseNS::CEE_LDLOC_2,        ReaderBaseNS::CEE_LDLOC_3,
  ReaderBaseNS::CEE_STLOC_0,        ReaderBaseNS::CEE_STLOC_1,
  ReaderBaseNS::CEE_STLOC_2,        ReaderBaseNS::CEE_STLOC_3,
  ReaderBaseNS::CEE_LDARG_S,        ReaderBaseNS::CEE_LDARGA_S,
  ReaderBaseNS::CEE_STARG_S,        ReaderBaseNS::CEE_LDLOC_S,
  ReaderBaseNS::CEE_LDLOCA_S,       ReaderBaseNS::CEE_STLOC_S,
  ReaderBaseNS::CEE_LDNULL,         ReaderBaseNS::CEE_LDC_I4_M1,
  ReaderBaseNS::CEE_LDC_I4_0,       ReaderBaseNS::CEE_LDC_I4_1,
  ReaderBaseNS::CEE_LDC_I4_2,       ReaderBaseNS::CEE_LDC_I4_3,
  ReaderBaseNS::CEE_LDC_I4_4,       ReaderBaseNS::CEE_LDC_I4_5,
  ReaderBaseNS::CEE_LDC_I4_6,       ReaderBaseNS::CEE_LDC_I4_7,
  ReaderBaseNS::CEE_LDC_I4_8,       ReaderBaseNS::CEE_LDC_I4_S,
  ReaderBaseNS::CEE_LDC_I4,         ReaderBaseNS::CEE_LDC_I8,
  ReaderBaseNS::CEE_LDC_R4,         ReaderBaseNS::CEE_LDC_R8,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED49,
  ReaderBaseNS::CEE_DUP,            ReaderBaseNS::CEE_POP,
  ReaderBaseNS::CEE_JMP,            ReaderBaseNS::CEE_CALL,
  ReaderBaseNS::CEE_CALLI,          ReaderBaseNS::CEE_RET,
  ReaderBaseNS::CEE_BR_S,           ReaderBaseNS::CEE_BRFALSE_S,
  ReaderBaseNS::CEE_BRTRUE_S,       ReaderBaseNS::CEE_BEQ_S,
  ReaderBaseNS::CEE_BGE_S,          ReaderBaseNS::CEE_BGT_S,
  ReaderBaseNS::CEE_BLE_S,          ReaderBaseNS::CEE_BLT_S,
  ReaderBaseNS::CEE_BNE_UN_S,       ReaderBaseNS::CEE_BGE_UN_S,
  ReaderBaseNS::CEE_BGT_UN_S,       ReaderBaseNS::CEE_BLE_UN_S,
  ReaderBaseNS::CEE_BLT_UN_S,       ReaderBaseNS::CEE_BR,
  ReaderBaseNS::CEE_BRFALSE,        ReaderBaseNS::CEE_BRTRUE,
  ReaderBaseNS::CEE_BEQ,            ReaderBaseNS::CEE_BGE,
  ReaderBaseNS::CEE_BGT,            ReaderBaseNS::CEE_BLE,
  ReaderBaseNS::CEE_BLT,            ReaderBaseNS::CEE_BNE_UN,
  ReaderBaseNS::CEE_BGE_UN,         ReaderBaseNS::CEE_BGT_UN,
  ReaderBaseNS::CEE_BLE_UN,         ReaderBaseNS::CEE_BLT_UN,
  ReaderBaseNS::CEE_SWITCH,         ReaderBaseNS::CEE_LDIND_I1,
  ReaderBaseNS::CEE_LDIND_U1,       ReaderBaseNS::CEE_LDIND_I2,
  ReaderBaseNS::CEE_LDIND_U2,       ReaderBaseNS::CEE_LDIND_I4,
  ReaderBaseNS::CEE_LDIND_U4,       ReaderBaseNS::CEE_LDIND_I8,
  ReaderBaseNS::CEE_LDIND_I,        ReaderBaseNS::CEE_LDIND_R4,
  ReaderBaseNS::CEE_LDIND_R8,       ReaderBaseNS::CEE_LDIND_REF,
  ReaderBaseNS::CEE_STIND_REF,      ReaderBaseNS::CEE_STIND_I1,
  ReaderBaseNS::CEE_STIND_I2,       ReaderBaseNS::CEE_STIND_I4,
  ReaderBaseNS::CEE_STIND_I8,       ReaderBaseNS::CEE_STIND_R4,
  ReaderBaseNS::CEE_STIND_R8,       ReaderBaseNS::CEE_ADD,
  ReaderBaseNS::CEE_SUB,            ReaderBaseNS::CEE_MUL,
  ReaderBaseNS::CEE_DIV,            ReaderBaseNS::CEE_DIV_UN,
  ReaderBaseNS::CEE_REM,            ReaderBaseNS::CEE_REM_UN,
  ReaderBaseNS::CEE_AND,            ReaderBaseNS::CEE_OR,
  ReaderBaseNS::CEE_XOR,            ReaderBaseNS::CEE_SHL,
  ReaderBaseNS::CEE_SHR,            ReaderBaseNS::CEE_SHR_UN,
  ReaderBaseNS::CEE_NEG,            ReaderBaseNS::CEE_NOT,
  ReaderBaseNS::CEE_CONV_I1,        ReaderBaseNS::CEE_CONV_I2,
  ReaderBaseNS::CEE_CONV_I4,        ReaderBaseNS::CEE_CONV_I8,
  ReaderBaseNS::CEE_CONV_R4,        ReaderBaseNS::CEE_CONV_R8,
  ReaderBaseNS::CEE_CONV_U4,        ReaderBaseNS::CEE_CONV_U8,
  ReaderBaseNS::CEE_CALLVIRT,       ReaderBaseNS::CEE_CPOBJ,
  ReaderBaseNS::CEE_LDOBJ,          ReaderBaseNS::CEE_LDSTR,
  ReaderBaseNS::CEE_NEWOBJ,         ReaderBaseNS::CEE_CASTCLASS,
  ReaderBaseNS::CEE_ISINST,         ReaderBaseNS::CEE_CONV_R_UN,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED58,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED1,
  ReaderBaseNS::CEE_UNBOX,          ReaderBaseNS::CEE_THROW,
  ReaderBaseNS::CEE_LDFLD,          ReaderBaseNS::CEE_LDFLDA,
  ReaderBaseNS::CEE_STFLD,          ReaderBaseNS::CEE_LDSFLD,
  ReaderBaseNS::CEE_LDSFLDA,        ReaderBaseNS::CEE_STSFLD,
  ReaderBaseNS::CEE_STOBJ,          ReaderBaseNS::CEE_CONV_OVF_I1_UN,
  ReaderBaseNS::CEE_CONV_OVF_I2_UN, ReaderBaseNS::CEE_CONV_OVF_I4_UN,
  ReaderBaseNS::CEE_CONV_OVF_I8_UN, ReaderBaseNS::CEE_CONV_OVF_U1_UN,
  ReaderBaseNS::CEE_CONV_OVF_U2_UN, ReaderBaseNS::CEE_CONV_OVF_U4_UN,
  ReaderBaseNS::CEE_CONV_OVF_U8_UN, ReaderBaseNS::CEE_CONV_OVF_I_UN,
  ReaderBaseNS::CEE_CONV_OVF_U_UN,  ReaderBaseNS::CEE_BOX,
  ReaderBaseNS::CEE_NEWARR,         ReaderBaseNS::CEE_LDLEN,
  ReaderBaseNS::CEE_LDELEMA,        ReaderBaseNS::CEE_LDELEM_I1,
  ReaderBaseNS::CEE_LDELEM_U1,      ReaderBaseNS::CEE_LDELEM_I2,
  ReaderBaseNS::CEE_LDELEM_U2,      ReaderBaseNS::CEE_LDELEM_I4,
  ReaderBaseNS::CEE_LDELEM_U4,      ReaderBaseNS::CEE_LDELEM_I8,
  ReaderBaseNS::CEE_LDELEM_I,       ReaderBaseNS::CEE_LDELEM_R4,
  ReaderBaseNS::CEE_LDELEM_R8,      ReaderBaseNS::CEE_LDELEM_REF,
  ReaderBaseNS::CEE_STELEM_I,       ReaderBaseNS::CEE_STELEM_I1,
  ReaderBaseNS::CEE_STELEM_I2,      ReaderBaseNS::CEE_STELEM_I4,
  ReaderBaseNS::CEE_STELEM_I8,      ReaderBaseNS::CEE_STELEM_R4,
  ReaderBaseNS::CEE_STELEM_R8,      ReaderBaseNS::CEE_STELEM_REF,
  ReaderBaseNS::CEE_LDELEM,         ReaderBaseNS::CEE_STELEM,
  ReaderBaseNS::CEE_UNBOX_ANY,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED5,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED6,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED7,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED8,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED9,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED10,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED11,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED12,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED13,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED14,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED15,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED16,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED17,
  ReaderBaseNS::CEE_CONV_OVF_I1,    ReaderBaseNS::CEE_CONV_OVF_U1,
  ReaderBaseNS::CEE_CONV_OVF_I2,    ReaderBaseNS::CEE_CONV_OVF_U2,
  ReaderBaseNS::CEE_CONV_OVF_I4,    ReaderBaseNS::CEE_CONV_OVF_U4,
  ReaderBaseNS::CEE_CONV_OVF_I8,    ReaderBaseNS::CEE_CONV_OVF_U8,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED50,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED18,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED19,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED20,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED21,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED22,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED23,
  ReaderBaseNS::CEE_REFANYVAL,      ReaderBaseNS::CEE_CKFINITE,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED24,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED25,
  ReaderBaseNS::CEE_MKREFANY,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED59,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED60,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED61,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED62,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED63,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED64,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED65,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED66,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED67,
  ReaderBaseNS::CEE_LDTOKEN,        ReaderBaseNS::CEE_CONV_U2,
  ReaderBaseNS::CEE_CONV_U1,        ReaderBaseNS::CEE_CONV_I,
  ReaderBaseNS::CEE_CONV_OVF_I,     ReaderBaseNS::CEE_CONV_OVF_U,
  ReaderBaseNS::CEE_ADD_OVF,        ReaderBaseNS::CEE_ADD_OVF_UN,
  ReaderBaseNS::CEE_MUL_OVF,        ReaderBaseNS::CEE_MUL_OVF_UN,
  ReaderBaseNS::CEE_SUB_OVF,        ReaderBaseNS::CEE_SUB_OVF_UN,
  ReaderBaseNS::CEE_ENDFINALLY,     ReaderBaseNS::CEE_LEAVE,
  ReaderBaseNS::CEE_LEAVE_S,        ReaderBaseNS::CEE_STIND_I,
  ReaderBaseNS::CEE_CONV_U,         ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL,
  ReaderBaseNS::CEE_ILLEGAL,        ReaderBaseNS::CEE_ILLEGAL};

// Array which maps prefixed bytecode to WVM opcode.
static const ReaderBaseNS::OPCODE PrefixedByteCodes[33] = {
  ReaderBaseNS::CEE_ARGLIST,   ReaderBaseNS::CEE_CEQ,
  ReaderBaseNS::CEE_CGT,       ReaderBaseNS::CEE_CGT_UN,
  ReaderBaseNS::CEE_CLT,       ReaderBaseNS::CEE_CLT_UN,
  ReaderBaseNS::CEE_LDFTN,     ReaderBaseNS::CEE_LDVIRTFTN,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED56,
  ReaderBaseNS::CEE_LDARG,     ReaderBaseNS::CEE_LDARGA,
  ReaderBaseNS::CEE_STARG,     ReaderBaseNS::CEE_LDLOC,
  ReaderBaseNS::CEE_LDLOCA,    ReaderBaseNS::CEE_STLOC,
  ReaderBaseNS::CEE_LOCALLOC,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED57,
  ReaderBaseNS::CEE_ENDFILTER, ReaderBaseNS::CEE_UNALIGNED,
  ReaderBaseNS::CEE_VOLATILE,  ReaderBaseNS::CEE_TAILCALL,
  ReaderBaseNS::CEE_INITOBJ,   ReaderBaseNS::CEE_CONSTRAINED,
  ReaderBaseNS::CEE_CPBLK,     ReaderBaseNS::CEE_INITBLK,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED69,
  ReaderBaseNS::CEE_RETHROW,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED51,
  ReaderBaseNS::CEE_SIZEOF,    ReaderBaseNS::CEE_REFANYTYPE,
  ReaderBaseNS::CEE_READONLY,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED53,
  ReaderBaseNS::CEE_ILLEGAL, // ReaderBaseNS::CEE_UNUSED54
};
